package com.example.lotterysystem.service.dto;

import com.example.lotterysystem.service.enums.ActivityPrizeStatusEnum;
import com.example.lotterysystem.service.enums.ActivityPrizeTiersEnum;
import com.example.lotterysystem.service.enums.ActivityStatusEnum;
import com.example.lotterysystem.service.enums.ActivityUserStatusEnum;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

@Data
public class ActivityDetailDTO implements Serializable {

    //保存活动相关信息
    private Long activityId;
    private String activityName;
    private String desc;
    private ActivityStatusEnum status;

    //活动奖品相关信息
    private List<PrizeDTO> prizeDTOList;

    //人员相关信息
    private List<UserDTO> userDTOList;

    //判断活动是否有效
    public boolean valid(){
        return status.equals(ActivityStatusEnum.RUNNING);
    }

    @Data
    public static class PrizeDTO{
        private Long prizeId;
        private String description;
        private String imageUrl;
        private String name;
        private BigDecimal price;
        private ActivityPrizeTiersEnum tiers;
        private ActivityPrizeStatusEnum status;
        private Long prizeAmount;

        //判断奖品是否有效
        public boolean valid(){
            return status.equals(ActivityPrizeStatusEnum.INIT);
        }

    }

    @Data
    public static class UserDTO{
        private Long userId;
        private String userName;
        private ActivityUserStatusEnum status;

        //判断活动人员是否已经抽过奖
        public boolean valid(){
            return status.equals(ActivityUserStatusEnum.INIT);
        }
    }


}
